home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / OSA.lisp < prev    next >
Encoding:
Text File  |  1994-09-13  |  28.1 KB  |  606 lines  |  [TEXT/CCL2]

  1.  
  2. (in-package :TRAPS)             ; 
  3. ; ////////////////////////////////////////////////////////////////////////////////
  4. ; // OPEN SCRIPTING ARCHITECTURE: Client Interface
  5. ; ////////////////////////////////////////////////////////////////////////////////
  6. ; // Copyright © 1992 Apple Computer, Inc. All rights reserved.
  7. ; // Authors: Jens Alfke, William Cook, Donn Denman, and Warren Harris
  8. ; ////////////////////////////////////////////////////////////////////////////////
  9. ; // This interface defines what it means to be a "scripting component."
  10. ; // Scripting components allow "scripts" to be loaded and executed.  This
  11. ; // interface does not define the way in which a particular scripting
  12. ; // component's scripts are editing and debugged.
  13. ; ////////////////////////////////////////////////////////////////////////////////
  14.  
  15. ; $IFC UNDEFINED UsingIncludes
  16. ; $SETC UsingIncludes := 0
  17. ; $ENDC
  18.  
  19. ; $IFC NOT UsingIncludes
  20.  
  21. ; $ENDC
  22.  
  23. ; $IFC UNDEFINED UsingOSA
  24. ; $SETC UsingOSA := 1
  25.  
  26. ; $I+
  27. ; $SETC OSAIncludes := UsingIncludes
  28. ; $SETC UsingIncludes := 1
  29. ; $IFC UNDEFINED UsingAppleEvents
  30.  
  31. (require-interface 'APPLEEVENTS); $I $$Shell(PInterfaces)AppleEvents.p
  32. ; $ENDC
  33. ; $IFC UNDEFINED UsingAEObjects
  34.  
  35. (require-interface 'AEOBJECTS)  ; $I $$Shell(PInterfaces)AEObjects.p
  36. ; $ENDC
  37. ; $IFC UNDEFINED UsingComponents
  38.  
  39. (require-interface 'COMPONENTS) ; $I $$Shell(PInterfaces)Components.p
  40. ; $ENDC
  41. ; $SETC UsingIncludes := OSAIncludes
  42.  
  43. ;  Types and Constants 
  44.  
  45. (defconstant $kOSAComponentType :|osa |)
  46. (defconstant $kOSAGenericScriptingComponentSubtype :|scpt|)
  47.  
  48. (defconstant $kOSAFileType :|osas|)
  49. ;  Type of script document files. 
  50.  
  51. (def-mactype :OSAID (find-mactype :SIGNED-LONG))
  52. (def-mactype :OSAERROR (find-mactype :SIGNED-LONG))
  53.  
  54. (defconstant $kOSANullScript 0)
  55. (defconstant $kOSANullMode 0)
  56. (defconstant $kOSAModeNull 0)
  57.  
  58. (defconstant $kOSASuite :|ascr|)
  59. (defconstant $kOSARecordedText :|recd|)
  60.  
  61. (defconstant $kOSAScriptResourceType #$KOSAGENERICSCRIPTINGCOMPONENTSUBTYPE)
  62. (defconstant $typeOSAGenericStorage #$KOSASCRIPTRESOURCETYPE)
  63.  
  64. ;  Error Codes 
  65.  
  66. ;  API Errors 
  67. (defconstant $errOSASystemError -1750)
  68. (defconstant $errOSAInvalidID -1751)
  69. (defconstant $errOSABadStorageType -1752)
  70. (defconstant $errOSAScriptError -1753)
  71. (defconstant $errOSABadSelector -1754)
  72. (defconstant $errOSASourceNotAvailable -1756)
  73. (defconstant $errOSANoSuchDialect -1757)
  74. (defconstant $errOSADataFormatObsolete -1758)
  75. (defconstant $errOSADataFormatTooNew -1759)
  76. (defconstant $errOSACorruptData #$ERRAECORRUPTDATA)
  77. (defconstant $errOSARecordingIsAlreadyOn #$ERRAERECORDINGISALREADYON)
  78.  
  79. ;  Dynamic errors 
  80. (defconstant $errOSACantCoerce #$ERRAECOERCIONFAIL)
  81. (defconstant $errOSACantAccess #$ERRAENOSUCHOBJECT)
  82. (defconstant $errOSACantAssign -10006)
  83. (defconstant $errOSAGeneralError -2700)
  84. (defconstant $errOSADivideByZero -2701)
  85. (defconstant $errOSANumericOverflow -2702)
  86. (defconstant $errOSACantLaunch -2703)
  87. (defconstant $errOSAAppNotHighLevelEventAware -2704)
  88. (defconstant $errOSACorruptTerminology -2705)
  89. (defconstant $errOSAStackOverflow -2706)
  90. (defconstant $errOSAInternalTableOverflow -2707)
  91. (defconstant $errOSADataBlockTooLarge -2708)
  92.  
  93. ;  Component-specific dynamic script errors: -2720 thru -2739 
  94.  
  95. ;  Static errors 
  96. (defconstant $errOSATypeError #$ERRAEWRONGDATATYPE)
  97. (defconstant $errOSAMessageNotUnderstood #$ERRAEEVENTNOTHANDLED)
  98. (defconstant $errOSAUndefinedHandler #$ERRAEHANDLERNOTFOUND)
  99. (defconstant $errOSAIllegalAccess #$ERRAEACCESSORNOTFOUND)
  100. (defconstant $errOSAIllegalIndex #$ERRAEILLEGALINDEX)
  101. (defconstant $errOSAIllegalRange #$ERRAEIMPOSSIBLERANGE)
  102. (defconstant $errOSAIllegalAssign -10003)
  103. (defconstant $errOSASyntaxError -2740)
  104. (defconstant $errOSASyntaxTypeError -2741)
  105. (defconstant $errOSATokenTooLong -2742)
  106. (defconstant $errOSAMissingParameter #$ERRAEDESCNOTFOUND)
  107. (defconstant $errOSAParameterMismatch #$ERRAEWRONGNUMBERARGS)
  108. (defconstant $errOSADuplicateParameter -2750)
  109. (defconstant $errOSADuplicateProperty -2751)
  110. (defconstant $errOSADuplicateHandler -2752)
  111. (defconstant $errOSAUndefinedVariable -2753)
  112. (defconstant $errOSAInconsistentDeclarations -2754)
  113. (defconstant $errOSAControlFlowError -2755)
  114.  
  115. ;  Component-specific static script errors: -2760 thru -2779 
  116.  
  117. ;  Dialect-specific script errors: -2780 thru -2799 
  118.  
  119. ; ////////////////////////////////////////////////////////////////////////////////
  120. ; // OSA Interface Descriptions
  121. ; ////////////////////////////////////////////////////////////////////////////////
  122. ; // The OSA Interface is broken down into a required interface, and several
  123. ; // optional interfaces to support additional functionality.  A given scripting
  124. ; // component may choose to support only some of the optional interfaces in
  125. ; // addition to the basic interface.  The OSA Component Flags may be used to 
  126. ; // query the Component Manager to find a scripting component with a particular
  127. ; // capability, or determine if a particular scripting component supports a 
  128. ; // particular capability.
  129. ; ////////////////////////////////////////////////////////////////////////////////
  130.  
  131. ;  OSA Component Flags 
  132. (defconstant $kOSASupportsCompiling #X2)
  133. (defconstant $kOSASupportsGetSource #X4)
  134. (defconstant $kOSASupportsAECoercion #X8)
  135. (defconstant $kOSASupportsAESending #X10)
  136. (defconstant $kOSASupportsRecording #X20)
  137. (defconstant $kOSASupportsConvenience #X40)
  138. (defconstant $kOSASupportsDialects #X80)
  139. (defconstant $kOSASupportsEventHandling #X100)
  140.  
  141. ;  Component Selectors 
  142. ;  Basic Scripting: 
  143. (defconstant $kOSASelectLoad #X1)
  144. (defconstant $kOSASelectStore #X2)
  145. (defconstant $kOSASelectExecute #X3)
  146. (defconstant $kOSASelectDisplay #X4)
  147. (defconstant $kOSASelectScriptError #X5)
  148. (defconstant $kOSASelectDispose #X6)
  149. (defconstant $kOSASelectSetScriptInfo #X7)
  150. (defconstant $kOSASelectGetScriptInfo #X8)
  151. (defconstant $kOSASelectSetActiveProc #X9)
  152. (defconstant $kOSASelectGetActiveProc #XA)
  153. ;  Compiling: 
  154. (defconstant $kOSASelectScriptingComponentName #X102)
  155. (defconstant $kOSASelectCompile #X103)
  156. (defconstant $kOSASelectCopyID #X104)
  157. ;  GetSource: 
  158. (defconstant $kOSASelectGetSource #X201)
  159. ;  AECoercion: 
  160. (defconstant $kOSASelectCoerceFromDesc #X301)
  161. (defconstant $kOSASelectCoerceToDesc #X302)
  162. ;  AESending: 
  163. (defconstant $kOSASelectSetSendProc #X401)
  164. (defconstant $kOSASelectGetSendProc #X402)
  165. (defconstant $kOSASelectSetCreateProc #X403)
  166. (defconstant $kOSASelectGetCreateProc #X404)
  167. (defconstant $kOSASelectSetDefaultTarget #X405)
  168. ;  Recording: 
  169. (defconstant $kOSASelectStartRecording #X501)
  170. (defconstant $kOSASelectStopRecording #X502)
  171. ;  Convenience: 
  172. (defconstant $kOSASelectLoadExecute #X601)
  173. (defconstant $kOSASelectCompileExecute #X602)
  174. (defconstant $kOSASelectDoScript #X603)
  175. ;  Dialects: 
  176. (defconstant $kOSASelectSetCurrentDialect #X701)
  177. (defconstant $kOSASelectGetCurrentDialect #X702)
  178. (defconstant $kOSASelectAvailableDialects #X703)
  179. (defconstant $kOSASelectGetDialectInfo #X704)
  180. (defconstant $kOSASelectAvailableDialectCodeList #X705)
  181. ;  Event Handling: 
  182. (defconstant $kOSASelectSetResumeDispatchProc #X801)
  183. (defconstant $kOSASelectGetResumeDispatchProc #X802)
  184. (defconstant $kOSASelectExecuteEvent #X803)
  185. (defconstant $kOSASelectDoEvent #X804)
  186. (defconstant $kOSASelectMakeContext #X805)
  187.  
  188. (defconstant $kOSASelectComponentSpecificStart #X1001)
  189. ;  scripting component specific selectors are added beginning with this 
  190. ;       value 
  191.  
  192. ;  Mode Flags 
  193. (defconstant $kOSAModePreventGetSource #X1)
  194. (defconstant $kOSAModeNeverInteract #$KAENEVERINTERACT)
  195. (defconstant $kOSAModeCanInteract #$KAECANINTERACT)
  196. (defconstant $kOSAModeAlwaysInteract #$KAEALWAYSINTERACT)
  197. (defconstant $kOSAModeDontReconnect #$KAEDONTRECONNECT)
  198. (defconstant $kOSAModeCantSwitchLayer #X40)
  199. (defconstant $kOSAModeDoRecord #X1000)
  200. (defconstant $kOSAModeCompileIntoContext #X2)
  201. (defconstant $kOSAModeAugmentContext #X4)
  202. (defconstant $kOSAModeDisplayForHumans #X8)
  203. (defconstant $kOSAModeDontStoreParent #X4000)
  204.  
  205. ; ////////////////////////////////////////////////////////////////////////////////
  206. ; // OSA Basic Scripting Interface
  207. ; ////////////////////////////////////////////////////////////////////////////////
  208. ; // Scripting components must at least support the Basic Scripting interface.
  209. ; ////////////////////////////////////////////////////////////////////////////////
  210.  
  211. ;  Loading and Storing Scripts 
  212.  
  213.  
  214. (deftrap _osaload ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptdata :aedesc) (modeflags :signed-long) (resultingscriptid (:pointer :signed-long)))
  215.    (:stack :signed-long)
  216.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptdata modeflags resultingscriptid ((+ (ash 12 16) 1) :signed-longint)))
  217.  
  218.  
  219. (deftrap _osastore ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptid :signed-long) (desiredtype :ostype) (modeflags :signed-long) (resultingscriptdata (:pointer :aedesc)))
  220.    (:stack :signed-long)
  221.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptid desiredtype modeflags resultingscriptdata ((+ (ash 16 16) 2) :signed-longint)))
  222.  
  223. ;  Executing Scripts 
  224.  
  225.  
  226. (deftrap _osaexecute ((scriptingcomponent (:pointer :componentinstancerecord)) (compiledscriptid :signed-long) (contextid :signed-long) (modeflags :signed-long) (resultingscriptvalueid (:pointer :signed-long)))
  227.    (:stack :signed-long)
  228.    (:stack-trap #xA82A :d0 0 scriptingcomponent compiledscriptid contextid modeflags resultingscriptvalueid ((+ (ash 16 16) 3) :signed-longint)))
  229.  
  230. ;  Displaying Results 
  231.  
  232.  
  233. (deftrap _osadisplay ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptvalueid :signed-long) (desiredtype :ostype) (modeflags :signed-long) (resultingtext (:pointer :aedesc)))
  234.    (:stack :signed-long)
  235.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptvalueid desiredtype modeflags resultingtext ((+ (ash 16 16) 4) :signed-longint)))
  236.  
  237. ;  Getting Error Information 
  238.  
  239.  
  240. (deftrap _osascripterror ((scriptingcomponent (:pointer :componentinstancerecord)) (selector :ostype) (desiredtype :ostype) (resultingerrordescription (:pointer :aedesc)))
  241.    (:stack :signed-long)
  242.    (:stack-trap #xA82A :d0 0 scriptingcomponent selector desiredtype resultingerrordescription ((+ (ash 12 16) 5) :signed-longint)))
  243.  
  244. ;  OSAScriptError selectors: 
  245. (defconstant $kOSAErrorNumber #$KEYERRORNUMBER)
  246. (defconstant $kOSAErrorMessage #$KEYERRORSTRING)
  247. (defconstant $kOSAErrorBriefMessage :|errb|)
  248. (defconstant $kOSAErrorApp :|erap|)
  249. (defconstant $kOSAErrorPartialResult :|ptlr|)
  250. (defconstant $kOSAErrorOffendingObject :|erob|)
  251. (defconstant $kOSAErrorExpectedType :|errt|)
  252. (defconstant $kOSAErrorRange :|erng|)
  253.  
  254. ;  text ranges: 
  255. (defconstant $typeOSAErrorRange :|erng|)
  256. (defconstant $keyOSASourceStart :|srcs|)
  257. (defconstant $keyOSASourceEnd :|srce|)
  258.  
  259. ;  Disposing Script IDs 
  260.  
  261.  
  262. (deftrap _osadispose ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptid :signed-long))
  263.    (:stack :signed-long)
  264.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptid ((+ (ash 4 16) 6) :signed-longint)))
  265.  
  266. ;  Getting and Setting Script Information 
  267.  
  268.  
  269. (deftrap _osasetscriptinfo ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptid :signed-long) (selector :ostype) (value :signed-long))
  270.    (:stack :signed-long)
  271.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptid selector value ((+ (ash 12 16) 7) :signed-longint)))
  272.  
  273.  
  274. (deftrap _osagetscriptinfo ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptid :signed-long) (selector :ostype) (result (:pointer :signed-long)))
  275.    (:stack :signed-long)
  276.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptid selector result ((+ (ash 12 16) 8) :signed-longint)))
  277.  
  278. ;  selectors 
  279. (defconstant $kOSAScriptIsModified :|modi|)
  280. (defconstant $kOSAScriptIsTypeCompiledScript :|cscr|)
  281. (defconstant $kOSAScriptIsTypeScriptValue :|valu|)
  282. (defconstant $kOSAScriptIsTypeScriptContext :|cntx|)
  283. (defconstant $kOSAScriptBestType :|best|)
  284. (defconstant $kOSACanGetSource :|gsrc|)
  285.  
  286. ;  Manipulating the ActiveProc 
  287.  
  288. (def-mactype :OSAACTIVEPROCPTR (find-mactype :POINTER))
  289.  
  290.  
  291. (deftrap _osasetactiveproc ((scriptingcomponent (:pointer :componentinstancerecord)) (activeproc :pointer) (refcon :signed-long))
  292.    (:stack :signed-long)
  293.    (:stack-trap #xA82A :d0 0 scriptingcomponent activeproc refcon ((+ (ash 8 16) 9) :signed-longint)))
  294.  
  295.  
  296. (deftrap _osagetactiveproc ((scriptingcomponent (:pointer :componentinstancerecord)) (activeproc (:pointer :pointer)) (refcon (:pointer :signed-long)))
  297.    (:stack :signed-long)
  298.    (:stack-trap #xA82A :d0 0 scriptingcomponent activeproc refcon ((+ (ash 8 16) 10) :signed-longint)))
  299.  
  300. ; ////////////////////////////////////////////////////////////////////////////////
  301. ; // OSA Optional Compiling Interface
  302. ; ////////////////////////////////////////////////////////////////////////////////
  303. ; // Scripting components that support the Compiling interface have the 
  304. ; // kOSASupportsCompiling bit set in it's ComponentDescription.
  305. ; ////////////////////////////////////////////////////////////////////////////////
  306.  
  307.  
  308. (deftrap _osascriptingcomponentname ((scriptingcomponent (:pointer :componentinstancerecord)) (resultingscriptingcomponentname (:pointer :aedesc)))
  309.    (:stack :signed-long)
  310.    (:stack-trap #xA82A :d0 0 scriptingcomponent resultingscriptingcomponentname ((+ (ash 4 16) 258) :signed-longint)))
  311.  
  312.  
  313. (deftrap _osacompile ((scriptingcomponent (:pointer :componentinstancerecord)) (sourcedata :aedesc) (modeflags :signed-long) (previousandresultingscriptid (:pointer :signed-long)))
  314.    (:stack :signed-long)
  315.    (:stack-trap #xA82A :d0 0 scriptingcomponent sourcedata modeflags previousandresultingscriptid ((+ (ash 12 16) 259) :signed-longint)))
  316.  
  317.  
  318. (deftrap _osacopyid ((scriptingcomponent (:pointer :componentinstancerecord)) (fromid :signed-long) (toid (:pointer :signed-long)))
  319.    (:stack :signed-long)
  320.    (:stack-trap #xA82A :d0 0 scriptingcomponent fromid toid ((+ (ash 8 16) 260) :signed-longint)))
  321.  
  322. ; ////////////////////////////////////////////////////////////////////////////////
  323. ; // OSA Optional GetSource Interface
  324. ; ////////////////////////////////////////////////////////////////////////////////
  325. ; // Scripting components that support the GetSource interface have the 
  326. ; // kOSASupportsGetSource bit set in it's ComponentDescription.
  327. ; ////////////////////////////////////////////////////////////////////////////////
  328.  
  329.  
  330. (deftrap _osagetsource ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptid :signed-long) (desiredtype :ostype) (resultingsourcedata (:pointer :aedesc)))
  331.    (:stack :signed-long)
  332.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptid desiredtype resultingsourcedata ((+ (ash 12 16) 513) :signed-longint)))
  333.  
  334. ; ////////////////////////////////////////////////////////////////////////////////
  335. ; // OSA Optional AECoercion Interface
  336. ; ////////////////////////////////////////////////////////////////////////////////
  337. ; // Scripting components that support the AECoercion interface have the 
  338. ; // kOSASupportsGetSource bit set in it's ComponentDescription.
  339. ; ////////////////////////////////////////////////////////////////////////////////
  340.  
  341.  
  342. (deftrap _osacoercefromdesc ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptdata :aedesc) (modeflags :signed-long) (resultingscriptid (:pointer :signed-long)))
  343.    (:stack :signed-long)
  344.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptdata modeflags resultingscriptid ((+ (ash 12 16) 769) :signed-longint)))
  345.  
  346.  
  347. (deftrap _osacoercetodesc ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptid :signed-long) (desiredtype :ostype) (modeflags :signed-long) (result (:pointer :aedesc)))
  348.    (:stack :signed-long)
  349.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptid desiredtype modeflags result ((+ (ash 16 16) 770) :signed-longint)))
  350.  
  351. ; ////////////////////////////////////////////////////////////////////////////////
  352. ; // OSA Optional AESending Interface
  353. ; ////////////////////////////////////////////////////////////////////////////////
  354. ; // Scripting components that support the AESending interface have the 
  355. ; // kOSASupportsAESending bit set in it's ComponentDescription.
  356. ; ////////////////////////////////////////////////////////////////////////////////
  357.  
  358. (def-mactype :AESENDPROCPTR (find-mactype :POINTER))
  359. (def-mactype :AECREATEAPPLEEVENTPROCPTR (find-mactype :POINTER))
  360.  
  361. ;   The first two proc pointers have the following interfaces
  362. ;    taken from AppleEvents.p 
  363. ;    
  364. ;     FUNCTION MyAECreateProc(theAEEventClass: AEEventClass;
  365. ;                             theAEEventID: AEEventID;
  366. ;                             target: AEAddressDesc;
  367. ;                             returnID: INTEGER;
  368. ;                             transactionID: LONGINT;
  369. ;                             VAR result: AppleEvent): OSErr;
  370. ;     
  371. ;     FUNCTION MyAESendProc(theAppleEvent: AppleEvent;
  372. ;                           VAR reply: AppleEvent;
  373. ;                           sendMode: AESendMode;
  374. ;                           sendPriority: AESendPriority;
  375. ;                           timeOutInTicks: LONGINT;
  376. ;                           idleProc: IdleProcPtr;
  377. ;                           filterProc: EventFilterProcPtr): OSErr;
  378. ;     FUNCTION MyActiveProc(): OSErr;
  379.  
  380.  
  381. (deftrap _osasetsendproc ((scriptingcomponent (:pointer :componentinstancerecord)) (sendproc :pointer) (refcon :signed-long))
  382.    (:stack :signed-long)
  383.    (:stack-trap #xA82A :d0 0 scriptingcomponent sendproc refcon ((+ (ash 8 16) 1025) :signed-longint)))
  384.  
  385.  
  386. (deftrap _osagetsendproc ((scriptingcomponent (:pointer :componentinstancerecord)) (sendproc (:pointer :pointer)) (refcon (:pointer :signed-long)))
  387.    (:stack :signed-long)
  388.    (:stack-trap #xA82A :d0 0 scriptingcomponent sendproc refcon ((+ (ash 8 16) 1026) :signed-longint)))
  389.  
  390.  
  391. (deftrap _osasetcreateproc ((scriptingcomponent (:pointer :componentinstancerecord)) (createproc :pointer) (refcon :signed-long))
  392.    (:stack :signed-long)
  393.    (:stack-trap #xA82A :d0 0 scriptingcomponent createproc refcon ((+ (ash 8 16) 1027) :signed-longint)))
  394.  
  395.  
  396. (deftrap _osagetcreateproc ((scriptingcomponent (:pointer :componentinstancerecord)) (createproc (:pointer :pointer)) (refcon (:pointer :signed-long)))
  397.    (:stack :signed-long)
  398.    (:stack-trap #xA82A :d0 0 scriptingcomponent createproc refcon ((+ (ash 8 16) 1028) :signed-longint)))
  399.  
  400.  
  401. (deftrap _osasetdefaulttarget ((scriptingcomponent (:pointer :componentinstancerecord)) (target :aedesc))
  402.    (:stack :signed-long)
  403.    (:stack-trap #xA82A :d0 0 scriptingcomponent target ((+ (ash 4 16) 1029) :signed-longint)))
  404.  
  405. ; ////////////////////////////////////////////////////////////////////////////////
  406. ; // OSA Optional Recording Interface
  407. ; ////////////////////////////////////////////////////////////////////////////////
  408. ; // Scripting components that support the Recording interface have the 
  409. ; // kOSASupportsRecording bit set in it's ComponentDescription.
  410. ; ////////////////////////////////////////////////////////////////////////////////
  411.  
  412.  
  413. (deftrap _osastartrecording ((scriptingcomponent (:pointer :componentinstancerecord)) (compiledscripttomodifyid (:pointer :signed-long)))
  414.    (:stack :signed-long)
  415.    (:stack-trap #xA82A :d0 0 scriptingcomponent compiledscripttomodifyid ((+ (ash 4 16) 1281) :signed-longint)))
  416.  
  417.  
  418. (deftrap _osastoprecording ((scriptingcomponent (:pointer :componentinstancerecord)) (compiledscriptid :signed-long))
  419.    (:stack :signed-long)
  420.    (:stack-trap #xA82A :d0 0 scriptingcomponent compiledscriptid ((+ (ash 4 16) 1282) :signed-longint)))
  421.  
  422. ; ////////////////////////////////////////////////////////////////////////////////
  423. ; // OSA Optional Convenience Interface
  424. ; ////////////////////////////////////////////////////////////////////////////////
  425. ; // Scripting components that support the Convenience interface have the 
  426. ; // kOSASupportsConvenience bit set in it's ComponentDescription.
  427. ; ////////////////////////////////////////////////////////////////////////////////
  428.  
  429.  
  430. (deftrap _osaloadexecute ((scriptingcomponent (:pointer :componentinstancerecord)) (scriptdata :aedesc) (contextid :signed-long) (modeflags :signed-long) (resultingscriptvalueid (:pointer :signed-long)))
  431.    (:stack :signed-long)
  432.    (:stack-trap #xA82A :d0 0 scriptingcomponent scriptdata contextid modeflags resultingscriptvalueid ((+ (ash 16 16) 1537) :signed-longint)))
  433.  
  434.  
  435. (deftrap _osacompileexecute ((scriptingcomponent (:pointer :componentinstancerecord)) (sourcedata :aedesc) (contextid :signed-long) (modeflags :signed-long) (resultingscriptvalueid (:pointer :signed-long)))
  436.    (:stack :signed-long)
  437.    (:stack-trap #xA82A :d0 0 scriptingcomponent sourcedata contextid modeflags resultingscriptvalueid ((+ (ash 16 16) 1538) :signed-longint)))
  438.  
  439.  
  440. (deftrap _osadoscript ((scriptingcomponent (:pointer :componentinstancerecord)) (sourcedata :aedesc) (contextid :signed-long) (desiredtype :ostype) (modeflags :signed-long) (resultingtext (:pointer :aedesc)))
  441.    (:stack :signed-long)
  442.    (:stack-trap #xA82A :d0 0 scriptingcomponent sourcedata contextid desiredtype modeflags resultingtext ((+ (ash 20 16) 1539) :signed-longint)))
  443.  
  444. ; ////////////////////////////////////////////////////////////////////////////////
  445. ; // OSA Optional Dialects Interface
  446. ; ////////////////////////////////////////////////////////////////////////////////
  447. ; // Scripting components that support the Dialects interface have the 
  448. ; // kOSASupportsDialects bit set in it's ComponentDescription.
  449. ; ////////////////////////////////////////////////////////////////////////////////
  450.  
  451.  
  452. (deftrap _osasetcurrentdialect ((scriptingcomponent (:pointer :componentinstancerecord)) (dialectcode :signed-integer))
  453.    (:stack :signed-long)
  454.    (:stack-trap #xA82A :d0 0 scriptingcomponent dialectcode ((+ (ash 2 16) 1793) :signed-longint)))
  455.  
  456.  
  457. (deftrap _osagetcurrentdialect ((scriptingcomponent (:pointer :componentinstancerecord)) (resultingdialectcode (:pointer :signed-integer)))
  458.    (:stack :signed-long)
  459.    (:stack-trap #xA82A :d0 0 scriptingcomponent resultingdialectcode ((+ (ash 4 16) 1794) :signed-longint)))
  460.  
  461.  
  462. (deftrap _osaavailabledialects ((scriptingcomponent (:pointer :componentinstancerecord)) (resultingdialectinfolist (:pointer :aedesc)))
  463.    (:stack :signed-long)
  464.    (:stack-trap #xA82A :d0 0 scriptingcomponent resultingdialectinfolist ((+ (ash 4 16) 1795) :signed-longint)))
  465. ;  *** This is obsolete. 
  466. ;  *** Use OSAAvailableDialectCodeList and OSAGetDialectInfo. 
  467.  
  468.  
  469. (deftrap _osagetdialectinfo ((scriptingcomponent (:pointer :componentinstancerecord)) (dialectcode :signed-integer) (selector :ostype) (resultingdialectinfo (:pointer :aedesc)))
  470.    (:stack :signed-long)
  471.    (:stack-trap #xA82A :d0 0 scriptingcomponent dialectcode selector resultingdialectinfo ((+ (ash 10 16) 1796) :signed-longint)))
  472.  
  473.  
  474. (deftrap _osaavailabledialectcodelist ((scriptingcomponent (:pointer :componentinstancerecord)) (resultingdialectcodelist :aedesc))
  475.    (:stack :signed-long)
  476.    (:stack-trap #xA82A :d0 0 scriptingcomponent resultingdialectcodelist ((+ (ash 4 16) 1797) :signed-longint)))
  477.  
  478. (defconstant $typeOSADialectInfo :|difo|)
  479. (defconstant $keyOSADialectName :|dnam|)
  480. (defconstant $keyOSADialectCode :|dcod|)
  481. (defconstant $keyOSADialectLangCode :|dlcd|)
  482. (defconstant $keyOSADialectScriptCode :|dscd|)
  483.  
  484. ; ////////////////////////////////////////////////////////////////////////////////
  485. ; // OSA Optional Event Handling Interface
  486. ; ////////////////////////////////////////////////////////////////////////////////
  487. ; // Scripting components that support the Event Handling interface have the 
  488. ; // kOSASupportsEventHandling bit set in it's ComponentDescription.
  489. ; ////////////////////////////////////////////////////////////////////////////////
  490.  
  491. (def-mactype :AEHANDLERPROCPTR (find-mactype :POINTER))
  492.  
  493.  
  494. (deftrap _osasetresumedispatchproc ((scriptingcomponent (:pointer :componentinstancerecord)) (resumedispatchproc :pointer) (refcon :signed-long))
  495.    (:stack :signed-long)
  496.    (:stack-trap #xA82A :d0 0 scriptingcomponent resumedispatchproc refcon ((+ (ash 8 16) 2049) :signed-longint)))
  497.  
  498. ;  ResumeDispatchProc constants 
  499. (defconstant $kOSAUseStandardDispatch #$KAEUSESTANDARDDISPATCH)
  500. (defconstant $kOSANoDispatch #$KAENODISPATCH)
  501. ;  OSASetResumeDispatchProc refCon constants 
  502. (defconstant $kOSADontUsePhac #X1)
  503.  
  504.  
  505. (deftrap _osagetresumedispatchproc ((scriptingcomponent (:pointer :componentinstancerecord)) (resumedispatchproc (:pointer :pointer)) (refcon (:pointer :signed-long)))
  506.    (:stack :signed-long)
  507.    (:stack-trap #xA82A :d0 0 scriptingcomponent resumedispatchproc refcon ((+ (ash 8 16) 2050) :signed-longint)))
  508.  
  509.  
  510. (deftrap _osaexecuteevent ((scriptingcomponent (:pointer :componentinstancerecord)) (theappleevent :aedesc) (contextid :signed-long) (modeflags :signed-long) (resultingscriptvalueid (:pointer :signed-long)))
  511.    (:stack :signed-long)
  512.    (:stack-trap #xA82A :d0 0 scriptingcomponent theappleevent contextid modeflags resultingscriptvalueid ((+ (ash 16 16) 2051) :signed-longint)))
  513.  
  514.  
  515. (deftrap _osadoevent ((scriptingcomponent (:pointer :componentinstancerecord)) (theappleevent :aedesc) (contextid :signed-long) (modeflags :signed-long) (reply (:pointer :aedesc)))
  516.    (:stack :signed-long)
  517.    (:stack-trap #xA82A :d0 0 scriptingcomponent theappleevent contextid modeflags reply ((+ (ash 16 16) 2052) :signed-longint)))
  518.  
  519.  
  520. (deftrap _osamakecontext ((scriptingcomponent (:pointer :componentinstancerecord)) (contextname :aedesc) (parentcontext :signed-long) (resultingcontextid (:pointer :signed-long)))
  521.    (:stack :signed-long)
  522.    (:stack-trap #xA82A :d0 0 scriptingcomponent contextname parentcontext resultingcontextid ((+ (ash 12 16) 2053) :signed-longint)))
  523.  
  524. ; $ENDC                         ;  UsingOSA 
  525.  
  526. ; $IFC NOT UsingIncludes
  527.  
  528. ; $ENDC
  529.  
  530. (export '($KOSADONTUSEPHAC $KOSANODISPATCH $KOSAUSESTANDARDDISPATCH
  531.           $KEYOSADIALECTSCRIPTCODE $KEYOSADIALECTLANGCODE $KEYOSADIALECTCODE
  532.           $KEYOSADIALECTNAME $TYPEOSADIALECTINFO $KOSACANGETSOURCE
  533.           $KOSASCRIPTBESTTYPE $KOSASCRIPTISTYPESCRIPTCONTEXT
  534.           $KOSASCRIPTISTYPESCRIPTVALUE $KOSASCRIPTISTYPECOMPILEDSCRIPT
  535.           $KOSASCRIPTISMODIFIED $KEYOSASOURCEEND $KEYOSASOURCESTART
  536.           $TYPEOSAERRORRANGE $KOSAERRORRANGE $KOSAERROREXPECTEDTYPE
  537.           $KOSAERROROFFENDINGOBJECT $KOSAERRORPARTIALRESULT $KOSAERRORAPP
  538.           $KOSAERRORBRIEFMESSAGE $KOSAERRORMESSAGE $KOSAERRORNUMBER
  539.           $KOSAMODEDONTSTOREPARENT $KOSAMODEDISPLAYFORHUMANS
  540.           $KOSAMODEAUGMENTCONTEXT $KOSAMODECOMPILEINTOCONTEXT $KOSAMODEDORECORD
  541.           $KOSAMODECANTSWITCHLAYER $KOSAMODEDONTRECONNECT
  542.           $KOSAMODEALWAYSINTERACT $KOSAMODECANINTERACT $KOSAMODENEVERINTERACT
  543.           $KOSAMODEPREVENTGETSOURCE $KOSASELECTCOMPONENTSPECIFICSTART
  544.           $KOSASELECTMAKECONTEXT $KOSASELECTDOEVENT $KOSASELECTEXECUTEEVENT
  545.           $KOSASELECTGETRESUMEDISPATCHPROC $KOSASELECTSETRESUMEDISPATCHPROC
  546.           $KOSASELECTAVAILABLEDIALECTCODELIST $KOSASELECTGETDIALECTINFO
  547.           $KOSASELECTAVAILABLEDIALECTS $KOSASELECTGETCURRENTDIALECT
  548.           $KOSASELECTSETCURRENTDIALECT $KOSASELECTDOSCRIPT
  549.           $KOSASELECTCOMPILEEXECUTE $KOSASELECTLOADEXECUTE
  550.           $KOSASELECTSTOPRECORDING $KOSASELECTSTARTRECORDING
  551.           $KOSASELECTSETDEFAULTTARGET $KOSASELECTGETCREATEPROC
  552.           $KOSASELECTSETCREATEPROC $KOSASELECTGETSENDPROC
  553.           $KOSASELECTSETSENDPROC $KOSASELECTCOERCETODESC
  554.           $KOSASELECTCOERCEFROMDESC $KOSASELECTGETSOURCE $KOSASELECTCOPYID
  555.           $KOSASELECTCOMPILE $KOSASELECTSCRIPTINGCOMPONENTNAME
  556.           $KOSASELECTGETACTIVEPROC $KOSASELECTSETACTIVEPROC
  557.           $KOSASELECTGETSCRIPTINFO $KOSASELECTSETSCRIPTINFO $KOSASELECTDISPOSE
  558.           $KOSASELECTSCRIPTERROR $KOSASELECTDISPLAY $KOSASELECTEXECUTE
  559.           $KOSASELECTSTORE $KOSASELECTLOAD $KOSASUPPORTSEVENTHANDLING
  560.           $KOSASUPPORTSDIALECTS $KOSASUPPORTSCONVENIENCE $KOSASUPPORTSRECORDING
  561.           $KOSASUPPORTSAESENDING $KOSASUPPORTSAECOERCION $KOSASUPPORTSGETSOURCE
  562.           $KOSASUPPORTSCOMPILING $ERROSACONTROLFLOWERROR
  563.           $ERROSAINCONSISTENTDECLARATIONS $ERROSAUNDEFINEDVARIABLE
  564.           $ERROSADUPLICATEHANDLER $ERROSADUPLICATEPROPERTY
  565.           $ERROSADUPLICATEPARAMETER $ERROSAPARAMETERMISMATCH
  566.           $ERROSAMISSINGPARAMETER $ERROSATOKENTOOLONG $ERROSASYNTAXTYPEERROR
  567.           $ERROSASYNTAXERROR $ERROSAILLEGALASSIGN $ERROSAILLEGALRANGE
  568.           $ERROSAILLEGALINDEX $ERROSAILLEGALACCESS $ERROSAUNDEFINEDHANDLER
  569.           $ERROSAMESSAGENOTUNDERSTOOD $ERROSATYPEERROR $ERROSADATABLOCKTOOLARGE
  570.           $ERROSAINTERNALTABLEOVERFLOW $ERROSASTACKOVERFLOW
  571.           $ERROSACORRUPTTERMINOLOGY $ERROSAAPPNOTHIGHLEVELEVENTAWARE
  572.           $ERROSACANTLAUNCH $ERROSANUMERICOVERFLOW $ERROSADIVIDEBYZERO
  573.           $ERROSAGENERALERROR $ERROSACANTASSIGN $ERROSACANTACCESS
  574.           $ERROSACANTCOERCE $ERROSARECORDINGISALREADYON $ERROSACORRUPTDATA
  575.           $ERROSADATAFORMATTOONEW $ERROSADATAFORMATOBSOLETE
  576.           $ERROSANOSUCHDIALECT $ERROSASOURCENOTAVAILABLE $ERROSABADSELECTOR
  577.           $ERROSASCRIPTERROR $ERROSABADSTORAGETYPE $ERROSAINVALIDID
  578.           $ERROSASYSTEMERROR $TYPEOSAGENERICSTORAGE $KOSASCRIPTRESOURCETYPE
  579.           $KOSARECORDEDTEXT $KOSASUITE $KOSAMODENULL $KOSANULLMODE
  580.           $KOSANULLSCRIPT $KOSAFILETYPE $KOSAGENERICSCRIPTINGCOMPONENTSUBTYPE
  581.           $KOSACOMPONENTTYPE))
  582. (provide-interface 'OSA)